/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pingouin;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Hippolyte
 */
public class main {

//    public Partie p;
//    private static main m;
    public Partie p;
    private static main m;
    Fenetre f;

//    Accueil a;
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        m = new main();

        m.run();
//        System.out.println(System.getProperty("user.dir" ));

    }

    public void run() {


        p = new Partie();

        f = new Fenetre(this);

    }

    public void commencerPartie(int nbJoueur, int nbOrdi, int niveau, boolean reseau) {

        p.init(nbJoueur, nbOrdi, niveau, reseau);

        Partie.ressources.messages.add("Placement des joueurs");

//        Partie.choixCases();

        if (reseau) {
            TServeurDebut tsd = new TServeurDebut(this);

            tsd.start();
        } else {
            debutPartie();
        }


    }

    public void debutPartie() {
        p.demarrePartie();
    }

    public void rejoindrePartie(String address) {
        try {
            Partie.adresseServeur = InetAddress.getByName(address);
        } catch (UnknownHostException ex) {
            Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
        }

        Partie.serveur = false;

        GestionSouris.tcc = new TClientCoord();
        GestionSouris.tcc.start();

        TClientDebut tcd = new TClientDebut();

        tcd.start();

        TClientRessources cst = new TClientRessources();

        cst.start();

    }
}
